﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WindowsFormsApplication1
{
    class Operators_Real : Operators
    {
        public override Number PlusMethod(Number s1, Number s2)
        {
            return new Real_number(s1.real_part + s2.real_part);
        }

        public override Number MinusMethod(Number s1, Number s2)
        {
            return new Real_number(s1.real_part - s2.real_part);
        }

        public override Number UmnozitMethod(Number s1, Number s2)
        {
            return new Real_number(s1.real_part * s2.real_part);
        }

        public override Number RarzelitMethod(Number s1, Number s2)
        {
            return new Real_number(s1.real_part/s2.real_part);
        }

        public override Number SqrtMethod(Number s)
        {
            if (s.real_part > 0) return new Real_number(Math.Sqrt(s.real_part));
            else return new Complex_number(0,Math.Sqrt(-s.real_part));
        }
    }
      
}
